
$(document).ready(function() {
	 
	$.ajax({
	  type: "GET",
	  url: "navigationConfig.xml",
	  dataType: "xml",
      success: function(xmlObject){   
         $(xmlObject).find("items > item").each(function(){
         	
       		var mf = $(this).attr("moduleFolder");
       		var ll = $(this).attr("leftLink");
       		var rl = $(this).attr("rightLink");
       		var tl = $(this).attr("totalLink"); 
       		
       		var mid = $(this).attr("moduleId");
       		 
       		var itext = $(this).children("text")[0];
       		//alert(itext.tagName);
       		//itext = $(itext);
       		var idesc = $(this).children("description")[0]; 
       		//idesc = $(idesc);
       		
       		//alert(itext.tagName);
       		
       		var aText = "<a href='#' >" + itext.childNodes[0].nodeValue + "</a>";
       		var emText = "<em style='top: -75px; display: none;'>" + idesc.childNodes[0].nodeValue + "</em>";
       		
       		var elemText = "<li onclick='gotoTab(this)'>" + aText + emText + "</li>";
       		        		
       		var item = $(elemText); 
       		
       		$(item).find("a").hover(function() { 
				$(this).next("em").animate({opacity: "show", top: "-75"}, "slow");
			}, function() { 
				$(this).next("em").animate({opacity: "hide", top: "-75"}, "fast");
			});  
       		
       		item.attr({moduleId:mid,
       				   leftLink:ll, 
       				   rightLink:rl, 
       				   totalLink:tl,
       				   moduleFolder:mf}); 
       		item.appendTo(".menu"); 
       		  
   		 }); 
   		 
      } 
	});  
	
	 
	 	 	 	  	 	  	 			     
 }); 
   
 function gotoTab(elem) {
 	   	 
 	var item = $(elem);
 	
 	var moduleId = item.attr("moduleId");
 	var totalLink = item.attr("totalLink");
 	var leftLink = item.attr("leftLink");
 	var rightlink = item.attr("rightlink");
 	var moduleFolder = item.attr("moduleFolder");
 	  
 	var link = "";
    if(totalLink == ""){
		link = "../frontModule/frame/mframe.html?" + moduleFolder + "&" + leftLink + "&" + rightlink;
	}
	else{
		link = "../frontModule/" + moduleFolder + "/" + totalLink; 
	} 
	window.parent.document.getElementById("contectFrame").src = link;  
 }